package com.wc.alorithm_blue_bridge._模拟.Q3223;

import java.util.Scanner;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/11/25-20:47
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] dp = new int[32];
        for (int i = 0; i < 32; i++) {
            dp[i] = (int) Math.pow(2, i);
        }
        int left = 0;
        int right = 31;
        int mid;
        while (left <= right) {
            mid = left + (right - left) / 2;
            if (dp[mid] > n) {
                right = mid - 1;
            } else if (dp[mid] < n) {
                left = mid + 1;
            } else {
                left = mid + 1;
            }
        }
        if (left == 0) {
            System.out.println(1);
        } else {
            System.out.println(dp[left - 1]);
        }
    }
}
